// /////////////////////////////////////////////////////////////////////////////
//
// Name:            asOctTreeComponent.cpp
// Author:          Michael Bartsch (ZCCdark203)
//
// Desc :           Binds the OctTreeComponent class to AngelScript
//
// License:         Copyright (C) 2009 Michael Bartsch and Contributors
//
//                  This program is free software: you can redistribute it
//                  and/or modify it under the terms of the zlib/libpng License.
//                  See main.cpp for conditions of distribution and use.
//
// /////////////////////////////////////////////////////////////////////////////

// Include files
#include "asOctTreeComponent.h"


#ifdef __COMPILE_WITH_ANGELSCRIPT__

#include "../../ScriptHelper.h"
#include "asSceneComponent.h"

#include "../../../components/scene/OctTreeComponent.h"


//! Reference factory for the OctTreeComponent class.
OctTreeComponent* createOctTreeComponent(Entity *parent)
{
    return new OctTreeComponent(parent);
}

//! Reference factory for the OctTreeComponent class.
OctTreeComponent* createOctTreeComponent(Entity *parent, s32 minPolysPerNode)
{
    return new OctTreeComponent(parent, minPolysPerNode);
}

//! Reference factory for the OctTreeComponent class.
OctTreeComponent* createOctTreeComponent(Entity *parent, const std::string &fileName,
                                                      s32 minPolysPerNode)
{
    return new OctTreeComponent(parent, fileName, minPolysPerNode);
}

//! Binds the AnimatedMeshComponent class to AngelScript.
void bindOctTreeComponent(asIScriptEngine *engine)
{
    // Forward declarations.
    int r;

    // Bind SkyDomeComponent class.
    r = engine->RegisterObjectType("OctTreeComponent", sizeof(OctTreeComponent), asOBJ_REF); assert(r >= 0);

    // Bind inherited functions.
    bindSceneComponentBase<OctTreeComponent>(engine, "OctTreeComponent");

    // Set SkyDomeComponent behaviour.
    r = engine->RegisterObjectBehaviour("OctTreeComponent", asBEHAVE_FACTORY, "OctTreeComponent@ f(Entity @+)",
                                        asFUNCTIONPR(createOctTreeComponent, (Entity*), OctTreeComponent*),
                                        asCALL_CDECL); assert(r >= 0);
    r = engine->RegisterObjectBehaviour("OctTreeComponent", asBEHAVE_FACTORY, "OctTreeComponent@ f(Entity @+, s32)",
                                        asFUNCTIONPR(createOctTreeComponent, (Entity*, s32), OctTreeComponent*),
                                        asCALL_CDECL); assert(r >= 0);
    r = engine->RegisterObjectBehaviour("OctTreeComponent", asBEHAVE_FACTORY, "OctTreeComponent@ f(Entity @+, " \
                                        "const string &in, s32)",
                                        asFUNCTIONPR(createOctTreeComponent, (Entity*, const std::string&,
                                        s32), OctTreeComponent*), asCALL_CDECL); assert(r >= 0);

    r = engine->RegisterObjectMethod("OctTreeComponent", "OctTreeComponent& opAssign(const OctTreeComponent &in)",
                                     asFUNCTION(assignT<OctTreeComponent>), asCALL_CDECL_OBJFIRST); assert(r >= 0);
}

#endif // __COMPILE_WITH_ANGELSCRIPT__

// End of File
